﻿//======================================================
//==     (c)2008 aspxcms inc by NeTCMS v1.0              ==
//==          Forum:bbs.aspxcms.com                   ==
//==         Website:www.aspxcms.com                  ==
//======================================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class down : NetCMS.Web.UI.BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
            getDownInfo();
    }

    /// <summary>
    /// 获取新闻附件下载信息
    /// </summary>
    protected void getDownInfo()
    {
        string id =Request.QueryString["id"];
        if (id != null && id != "")
        {
            NetCMS.Content.ContentManage news = new NetCMS.Content.ContentManage();
            string DownAdress = news.getNewsAccessory(int.Parse(id)).ToLower();
            DownAdress = DownAdress.Replace("{@dirfile}", NetCMS.Config.UIConfig.dirFile);
            DownAdress = DownAdress.Replace("{@dirtemplet}", NetCMS.Config.UIConfig.dirTemplet);
            string dimm = NetCMS.Config.UIConfig.dirDumm;
            if (dimm.Trim() != string.Empty)
            {
                dimm = "/" + dimm;
            }
            DownAdress = dimm + DownAdress;
            Response.Write("<script langauge=\"javascript\">self.location='" + DownAdress + "';</script>");
            Response.End();
        }
        else
        {
            Err();
        }
    }

    protected void Err()
    {
        Response.Write("<script language=\"javascript\">alert('参数传递错误!');history.back();</script>");
        Response.End();
    }
}
